package com.example.boot.modules.system.dto;

import com.example.starter.webmvc.valid.CreateValid;
import com.example.starter.webmvc.valid.UpdateValid;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 *
 * @author 王令
 * @since 2022-08-05
 */
@Data
@Accessors(chain = true)
public class AuthorityDto {

    @NotNull(message = "id不能为空", groups = UpdateValid.class)
    private Long id;

    /**
     * 资源名
     */
    @NotBlank(message = "资源名不能为空", groups = {CreateValid.class, UpdateValid.class})
    @Length(max = 32, message = "资源名长度不能超过32", groups = {CreateValid.class, UpdateValid.class})
    private String title;

    /**
     * 路由组件name或后端权限编码
     */
    @NotBlank(message = "路由组件名或后端权限编码不能为空", groups = {CreateValid.class, UpdateValid.class})
    @Length(max = 32, message = "路由组件name或后端权限编码长度不能超过32", groups = {CreateValid.class, UpdateValid.class})
    private String name;

    /**
     * 资源类型【0: 菜单，1: 后端接口权限】
     */
    @NotNull(message = "资源类型不能为空", groups = {CreateValid.class, UpdateValid.class})
    private Integer type;

    /**
     * 路径_前端路由
     */
    @Length(max = 255, message = "路径_前端路由长度不能超过255", groups = {CreateValid.class, UpdateValid.class})
    private String path;

    /**
     * 组件地址(路由组件地址 src为根路径)
     */
    @Length(max = 255, message = "组件地址长度不能超过255", groups = {CreateValid.class, UpdateValid.class})
    private String component;

    /**
     * 重定向
     */
    @Length(max = 255, message = "重定向地址长度不能超过16", groups = {CreateValid.class, UpdateValid.class})
    private String redirect;

    /**
     * 上级id
     */
    @NotNull(message = "上级项不能为空")
    private Long parentId;

    /**
     * 排序
     */
    private Integer order;

    /**
     * 图标
     */
    @Length(max = 16, message = "图标长度不能超过16", groups = {CreateValid.class, UpdateValid.class})
    private String icon;

    /**
     * 缓存
     */
    private Boolean cache;

    /**
     * 标签页
     */
    private Boolean affix;

    /**
     * 隐藏
     */
    private Boolean hidden;

}
